import { useEffect, useState } from "react";
import { type channel } from "@/apis/home";
import { getHomeData } from "@/apis/home";
function useChannels() {
    const [channels, setChannels] = useState<channel[]>();

  // 空数组 只在初始化执行一次
  useEffect(() => {
    getHomeData().then((res) => {
      setChannels(res.data?.channels);
    });
  }, []);

  return {
    channels,
    setChannels
  }
}

export {useChannels}